package a.j;

import a.c.e;
import a.j.a.b;
import a.j.a.j;

import java.awt.*;
import java.util.*;
import java.util.List;

public class w
{
  private qb a;
  private pg b;
  private List c = Collections.EMPTY_LIST;
  private double d = 5.0D;
  private double e;
  private double f;
  private List g = new ArrayList();
  private final List h = new ArrayList();
  private boolean i = true;
  private Color j = Color.LIGHT_GRAY;
  private a.d.w k = a.d.w.c;
  public static int l;
  
  public w(pg parampg)
  {
    this.b = parampg;
    this.a = new qb()
    {
      public void paint(Graphics2D paramAnonymousGraphics2D)
      {
        boolean bool2 = ld.E;
        boolean bool1 = ld.D;
        paramAnonymousGraphics2D.setColor(w.this.j);
        if (((bool2) || (w.this.c != null)) && (w.this.i))
        {
          a.d.w localw = new a.d.w(w.this.k.a + w.this.e, w.this.k.b + w.this.f);
          int i = 0;
          do
          {
            if (i >= w.this.c.size()) {
              break;
            }
            ((ve)w.this.c.get(i)).a(w.this, localw).paint(paramAnonymousGraphics2D);
            i++;
          } while (!bool1);
        }
      }
      
      public Rectangle getBounds()
      {
        boolean bool2 = ld.E;
        boolean bool1 = ld.D;
        Rectangle localRectangle1 = new Rectangle(0, 0, -1, -1);
        if (((bool2) || (w.this.c != null)) && (w.this.i))
        {
          a.d.w localw = new a.d.w(w.this.k.a + w.this.e, w.this.k.b + w.this.f);
          int i = 0;
          do
          {
            if (i >= w.this.c.size()) {
              break;
            }
            Rectangle localRectangle2 = ((ve)w.this.c.get(i)).a(w.this, localw).getBounds();
            if ((!bool2) && (bool1)) {
              break label167;
            }
            k.a(localRectangle2, localRectangle1, localRectangle1);
            i++;
          } while (!bool1);
        }
        label167:
        return localRectangle1;
      }
    };
  }
  
  public Color a()
  {
    return this.j;
  }
  
  public void a(Color paramColor)
  {
    this.j = paramColor;
  }
  
  public boolean b()
  {
    return this.i;
  }
  
  public void a(boolean paramBoolean)
  {
    this.i = paramBoolean;
  }
  
  public void a(ve paramve)
  {
    this.g.add(paramve);
  }
  
  public void b(ve paramve)
  {
    this.g.remove(paramve);
  }
  
  public void c()
  {
    this.g.clear();
  }
  
  protected a.d.w a(List paramList, a.d.w paramw)
  {
    boolean bool2 = ld.E;
    boolean bool1 = ld.D;
    a.d.w localw1 = l();
    this.c = paramList;
    this.c.addAll(this.g);
    if (!bool2)
    {
      if (this.c.size() > 0)
      {
        l.a(this.c, null);
        Point2D.Double localDouble = new Point2D.Double(paramw.a, paramw.b);
        byte b1 = 0;
        int m = 0;
        do
        {
          do
          {
            if (m >= this.c.size()) {
              break;
            }
            localObject = (ve)this.c.get(m);
            b1 = ((ve)localObject).a(paramw, localDouble, b1);
            m++;
            if ((!bool2) && (bool1)) {
              break label174;
            }
          } while (!bool1);
        } while (bool2);
        a.d.w localw2;
        if (b1 != 0) {
          localw2 = new a.d.w(localDouble.x, localDouble.y);
        } else {
          label174:
          localw2 = paramw;
        }
        Object localObject = new HashSet();
        int n = this.c.size() - 1;
        if (n >= 0) {}
        label313:
        do
        {
          ve localve = (ve)this.c.get(n);
          if (!bool2)
          {
            if (bool1) {
              break label349;
            }
            if (bool2) {}
          }
          else if (!localve.a(paramw, localw2, b1))
          {
            this.c.remove(n);
            if (bool2) {
              break label313;
            }
          }
          if ((bool1) && (localve.a() != null))
          {
            if (bool2) {
              break label313;
            }
            if (!((HashSet)localObject).add(localve.a())) {
              this.c.remove(n);
            }
          }
          n--;
          if (!bool1) {
            break;
          }
          this.e = (localw2.a - localw1.a);
        } while (bool2);
        this.f = (localw2.b - localw1.b);
        label349:
        return localw2;
      }
      this.e = (paramw.a - localw1.a);
    }
    this.f = (paramw.b - localw1.b);
    return paramw;
  }
  
  public pg d()
  {
    return this.b;
  }
  
  public qb e()
  {
    return this.a;
  }
  
  public void a(pg parampg)
  {
    this.b = parampg;
  }
  
  static void a(Graphics2D paramGraphics2D, double paramDouble1, double paramDouble2, double paramDouble3, double paramDouble4)
  {
    boolean bool2 = ld.E;
    boolean bool1 = ld.D;
    paramGraphics2D.draw(new Line2D.Double(paramDouble1, paramDouble2, paramDouble3, paramDouble4));
    if (!bool2)
    {
      if (paramDouble1 == paramDouble3)
      {
        if (!bool2) {}
        d2 = paramDouble2 > paramDouble4 ? -1.0D : 1.0D;
        d1 = 0.0D;
        if (bool2) {
          break label205;
        }
        if (!bool1) {
          break label189;
        }
      }
      if (bool2) {}
    }
    else if (paramDouble2 == paramDouble4)
    {
      if (!bool2) {}
      d1 = paramDouble1 > paramDouble3 ? -1.0D : 1.0D;
      d2 = 0.0D;
      if (bool2) {
        break label205;
      }
      if (!bool1) {
        break label189;
      }
    }
    double d1 = paramDouble3 - paramDouble1;
    double d2 = paramDouble4 - paramDouble2;
    double d3 = Math.abs(d1 * d1 + d2 * d2);
    if (!bool2)
    {
      if (d3 == 0.0D)
      {
        d1 = 1.0D;
        d2 = 0.0D;
        if (bool2) {
          break label210;
        }
        if (!bool1) {}
      }
      else
      {
        d1 /= d3;
      }
    }
    else {
      d2 /= d3;
    }
    label189:
    d1 *= 5.0D;
    d2 *= 5.0D;
    label205:
    d3 = -d2;
    label210:
    double d4 = d1;
    paramGraphics2D.draw(new Line2D.Double(paramDouble1 + d3, paramDouble2 + d4, paramDouble1 - d3, paramDouble2 - d4));
    paramGraphics2D.draw(new Line2D.Double(paramDouble1, paramDouble2, paramDouble1 + d3 + d1, paramDouble2 + d4 + d2));
    paramGraphics2D.draw(new Line2D.Double(paramDouble1, paramDouble2, paramDouble1 - d3 + d1, paramDouble2 - d4 + d2));
    paramGraphics2D.draw(new Line2D.Double(paramDouble3 + d3, paramDouble4 + d4, paramDouble3 - d3, paramDouble4 - d4));
    paramGraphics2D.draw(new Line2D.Double(paramDouble3, paramDouble4, paramDouble3 + d3 - d1, paramDouble4 + d4 - d2));
    paramGraphics2D.draw(new Line2D.Double(paramDouble3, paramDouble4, paramDouble3 - d3 - d1, paramDouble4 - d4 - d2));
  }
  
  static void c(Graphics2D paramGraphics2D, double paramDouble1, double paramDouble2, double paramDouble3, double paramDouble4)
  {
    boolean bool2 = ld.E;
    boolean bool1 = ld.D;
    paramGraphics2D.draw(new Line2D.Double(paramDouble1, paramDouble2, paramDouble3, paramDouble4));
    if (!bool2)
    {
      if (paramDouble1 == paramDouble3)
      {
        if (!bool2) {}
        d2 = paramDouble2 > paramDouble4 ? -1.0D : 1.0D;
        d1 = 0.0D;
        if (bool2) {
          break label205;
        }
        if (!bool1) {
          break label189;
        }
      }
      if (bool2) {}
    }
    else if (paramDouble2 == paramDouble4)
    {
      if (!bool2) {}
      d1 = paramDouble1 > paramDouble3 ? -1.0D : 1.0D;
      d2 = 0.0D;
      if (bool2) {
        break label205;
      }
      if (!bool1) {
        break label189;
      }
    }
    double d1 = paramDouble3 - paramDouble1;
    double d2 = paramDouble4 - paramDouble2;
    double d3 = Math.abs(d1 * d1 + d2 * d2);
    if (!bool2)
    {
      if (d3 == 0.0D)
      {
        d1 = 1.0D;
        d2 = 0.0D;
        if (bool2) {
          break label210;
        }
        if (!bool1) {}
      }
      else
      {
        d1 /= d3;
      }
    }
    else {
      d2 /= d3;
    }
    label189:
    d1 *= 5.0D;
    d2 *= 5.0D;
    label205:
    d3 = -d2;
    label210:
    double d4 = d1;
    paramGraphics2D.draw(new Line2D.Double(paramDouble1, paramDouble2, paramDouble1 + d3 + d1, paramDouble2 + d4 + d2));
    paramGraphics2D.draw(new Line2D.Double(paramDouble1, paramDouble2, paramDouble1 - d3 + d1, paramDouble2 - d4 + d2));
    paramGraphics2D.draw(new Line2D.Double(paramDouble3, paramDouble4, paramDouble3 + d3 - d1, paramDouble4 + d4 - d2));
    paramGraphics2D.draw(new Line2D.Double(paramDouble3, paramDouble4, paramDouble3 - d3 - d1, paramDouble4 - d4 - d2));
  }
  
  protected boolean a(ld paramld)
  {
    Rectangle localRectangle = this.b.getVisibleRect();
    return localRectangle.intersects(paramld.a(), paramld.b(), paramld.c(), paramld.d());
  }
  
  protected boolean a(tb paramtb, a.d.w paramw1, a.d.w paramw2)
  {
    Rectangle localRectangle = this.b.getVisibleRect();
    return localRectangle.intersectsLine(paramw1.a, paramw1.b, paramw2.a, paramw2.b);
  }
  
  protected void a(Collection paramCollection1, Collection paramCollection2)
  {
    boolean bool2 = ld.E;
    boolean bool1 = ld.D;
    g localg = this.b.a();
    j localj = localg.K();
    HashSet localHashSet = new HashSet();
    e locale1;
    if (localj != null)
    {
      localObject = paramCollection1.iterator();
      do
      {
        do
        {
          do
          {
            do
            {
              do
              {
                do
                {
                  if (!((Iterator)localObject).hasNext()) {
                    break;
                  }
                  locale1 = (e)((Iterator)localObject).next();
                } while (!localg.h(locale1));
                locale2 = localj.p(locale1);
              } while (locale2 == null);
              if ((bool2) || ((!bool2) && (bool1))) {
                break label167;
              }
            } while (bool1);
          } while (!a(locale2));
          if (bool2) {
            break;
          }
        } while (!localHashSet.add(locale2));
        e locale2 = localj.p(locale2);
      } while (!bool1);
    }
    if (!bool2) {
      label167:
      localHashSet.addAll(paramCollection1);
    }
    Object localObject = localg.v();
    do
    {
      if (!((a.c.w)localObject).e()) {
        break;
      }
      locale1 = ((a.c.w)localObject).d();
      if (!bool2)
      {
        if (!localHashSet.contains(locale1)) {
          paramCollection2.add(locale1);
        }
        ((a.c.w)localObject).f();
      }
    } while (!bool1);
  }
  
  private boolean a(e parame)
  {
    boolean bool = ld.E;
    g localg = this.b.a();
    if ((bool) || (localg != null))
    {
      ld localld = localg.w(parame);
      b localb = localld.K();
      if ((bool) || (localb != null)) {
        if (bool) {}
      }
      return localb.e();
    }
    return true;
  }
  
  public double f()
  {
    return this.d;
  }
  
  public void a(double paramDouble)
  {
    this.d = paramDouble;
  }
  
  public void g()
  {
    c();
    if (!ld.E)
    {
      if (this.b != null) {
        this.b.b(e());
      }
      this.c = Collections.EMPTY_LIST;
    }
    this.k = a.d.w.c;
  }
  
  protected void h()
  {
    d().a(e());
  }
  
  public void i()
  {
    this.c = Collections.EMPTY_LIST;
  }
  
  public void j()
  {
    this.h.clear();
  }
  
  public void a(ue paramue)
  {
    this.h.add(paramue);
  }
  
  protected List k()
  {
    return this.h;
  }
  
  public void a(a.d.w paramw)
  {
    this.k = paramw;
  }
  
  public a.d.w l()
  {
    return this.k;
  }
  
  List m()
  {
    return this.c;
  }
}



/* Location:           E:\idea\

 * Qualified Name:     a.j.w

 * JD-Core Version:    0.7.0.1

 */